from openai import OpenAI

# Set OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://127.0.0.1:8000/v1"

client = OpenAI(
    api_key=openai_api_key,
    base_url=openai_api_base,
)

# 生成嵌入向量
embedding_response = client.embeddings.create(
    model="llama3.2:latest",  # 使用你想要的模型
    input="什么草是绿的?",  # 输入文本
)

print(embedding_response.data)
# 打印嵌入向量
print("Embedding:", embedding_response.data[0].embedding)
